import { Controller, Get, Post, Body, Query } from '@nestjs/common';
import { BorrowService } from './borrow.service';
import { CreateDto } from './dto/create.dto'
import { GetBorrowsDto } from './dto/get-borrow.dto'
import { RemoveDto } from './dto/remove.dto'
import { UpdateDto } from './dto/update.dto'

@Controller('borrows')
export class BorrowController {
  constructor(private readonly borrowService: BorrowService) { }

  @Post("createBorrow")
  async createBorrow(@Body() createDto: CreateDto) {
    return this.borrowService.createBorrow(createDto);
  }

  @Get("getBorrowsByUserId")
  async getBorrowsByUserId(@Query() getBorrowsDto: GetBorrowsDto) {
    return this.borrowService.getBorrowsByUserId(getBorrowsDto);
  }

  @Post("updateBorrowByDataId")
  async updateBorrowByDataId(@Body() updateDto: UpdateDto) {
    return this.borrowService.updateBorrowByDataId(updateDto);
  }

  @Post("removeBorrowsByDataIds")
  async removeBorrowsByDataIds(@Body() removeDto: RemoveDto) {
    return this.borrowService.removeBorrowsByDataIds(removeDto);
  }

}